package com.wangzeqi.changliaoba.singleton;

import android.database.sqlite.SQLiteDatabase;
import com.android.volley.RequestQueue;
import com.android.volley.toolbox.Volley;
import com.easemob.chat.EMContactManager;
import com.easemob.chat.EMGroupManager;
import com.wangzeqi.changliaba.dao.DaoMaster;
import com.wangzeqi.changliaba.dao.DaoSession;
import com.wangzeqi.changliaoba.base.BaseApplication;

/**
 * Created by dllo on 16/3/2.
 */
public class AllSingleTon {


    private DaoMaster daoMaster;
    private DaoSession daoSession;
    private SQLiteDatabase db;

    private static class SingleHolder{
        private static final AllSingleTon ourInstance = new AllSingleTon();
    }

    public static AllSingleTon getOurInstance(){
        return SingleHolder.ourInstance;
    }

    public AllSingleTon() {
        daoSession = getDaoSession();
    }


    public   DaoSession getDaoSession() {
        DaoMaster.DevOpenHelper helper = new DaoMaster.DevOpenHelper(BaseApplication.applicationContext,"changliaoba",null);
        db = helper.getWritableDatabase();
        daoMaster = new DaoMaster(db);
        daoSession = daoMaster.newSession();
        return daoSession;
    }


}
